<template>
  <div id="user_proposal">
    <el-main>
      <el-button type="primary" @click="open">上传<i class="el-icon-edit-outline el-icon--right"></i></el-button>
      <el-table :data="proposal">
        <el-table-column prop="name" label="昵称" width="300">
        </el-table-column>
        <el-table-column prop="proposal" label="建议" width="300">
        </el-table-column>
        <el-table-column prop="proposalTime" label="发起时间" width="300">
        </el-table-column>
      </el-table>
    </el-main>
  </div>
</template>

<script>
export default {
  name: "user_proposal",
  data() {
    return{

    }
  },
  props: {
    email: null,
    proposal: {
      type: Array,
      default: () => []
    },
  },
  methods: {
    open() {
      this.$prompt('请输入反馈', '提示', {
        confirmButtonText: '提交',
        cancelButtonText: '取消',
        center: true,
      }).then(({value}) => {
        this.$http.get("http://localhost:8088/user/addProposal", {
          params: {
            email: this.email,
            message: value,
          }
        })
        this.$message({
          type: 'success',
          message: '已提交'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '取消输入'
        });
      });
    }
  }
}
</script>

<style scoped>
.el-header {
  background-color: #B3C0D1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
</style>